//
//  MHRedPacketBtn.m
//  MiaoCircle
//
//  Created by 许正荣 on 2018/11/8.
//  Copyright © 2018年 acgera. All rights reserved.
//

#import "MHRedPacketBtn.h"


@implementation MHRedPacketBtn

-(void) configRedPacketWithRedPacketWithRedInfo:(MHRedInfo *) redInfo redPacketPositon:(RedPackePostionType) position
{
    if (!redInfo || ![AXAppDelegate sharedDelegate].isAuthorizationExpired) {
        return;
    }
    switch (position) {
        case RedPackePostionCirle:
            [self configWithType:redInfo postion:@"theme"];
            
            break;
        case RedPackePostionNearby:
            [self configWithType:redInfo postion:@"found"];
            
            break;
        case RedPackePostionInVideo:
            [self configWithType:redInfo postion:@"video"];
            
            break;
        default:
            break;
    }
    
//    if (position == RedPackePostionCirle) {
//
//        [self config]
//    }
}

-(void) configWithType:(MHRedInfo *) info postion:(NSString *) postion
{
    ;
    switch (info.type) {
        case RedPacketInCircle:
            [self setBackgroundImage:[UIImage imageNamed:[NSString stringWithFormat:@"ic_%@_qn",postion]] forState:0];
            break;
        case RedPacketNearby:
            [self setBackgroundImage:[UIImage imageNamed:[NSString stringWithFormat:@"ic_%@_fj",postion]] forState:0];
             break;
        case RedPacketShare:
            [self setBackgroundImage:[UIImage imageNamed:[NSString stringWithFormat:@"ic_%@_fx",postion]] forState:0];
            break;
        default:
            break;
    }
    
    if ((info.isHaveReceived || info.status == RedPacketFinish || info.status == RedPacketExpired) && ![postion isEqualToString:@"video"]) {
        [self setBackgroundImage:[UIImage imageNamed:[NSString stringWithFormat:@"ic_%@_yl",postion]] forState:0];
    }
//    ic_theme_
}

@end
